package hhh.babysleep.model.dao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import hhh.babysleep.model.bean.Media;
import hhh.babysleep.model.bean.Music;
import hhh.babysleep.model.bean.Poem;
import hhh.babysleep.model.bean.Record;
import hhh.babysleep.model.bean.User;
import hhh.babysleep.model.bean.UserMusic;


// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig userDaoConfig;
    private final DaoConfig userMusicDaoConfig;
    private final DaoConfig mediaDaoConfig;
    private final DaoConfig musicDaoConfig;
    private final DaoConfig poemDaoConfig;
    private final DaoConfig recordDaoConfig;

    private final UserDao userDao;
    private final UserMusicDao userMusicDao;
    private final MediaDao mediaDao;
    private final MusicDao musicDao;
    private final PoemDao poemDao;
    private final RecordDao recordDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        userDaoConfig = daoConfigMap.get(UserDao.class).clone();
        userDaoConfig.initIdentityScope(type);

        userMusicDaoConfig = daoConfigMap.get(UserMusicDao.class).clone();
        userMusicDaoConfig.initIdentityScope(type);

        mediaDaoConfig = daoConfigMap.get(MediaDao.class).clone();
        mediaDaoConfig.initIdentityScope(type);

        musicDaoConfig = daoConfigMap.get(MusicDao.class).clone();
        musicDaoConfig.initIdentityScope(type);

        poemDaoConfig = daoConfigMap.get(PoemDao.class).clone();
        poemDaoConfig.initIdentityScope(type);

        recordDaoConfig = daoConfigMap.get(RecordDao.class).clone();
        recordDaoConfig.initIdentityScope(type);

        userDao = new UserDao(userDaoConfig, this);
        userMusicDao = new UserMusicDao(userMusicDaoConfig, this);
        mediaDao = new MediaDao(mediaDaoConfig, this);
        musicDao = new MusicDao(musicDaoConfig, this);
        poemDao = new PoemDao(poemDaoConfig, this);
        recordDao = new RecordDao(recordDaoConfig, this);

        registerDao(User.class, userDao);
        registerDao(UserMusic.class, userMusicDao);
        registerDao(Media.class, mediaDao);
        registerDao(Music.class, musicDao);
        registerDao(Poem.class, poemDao);
        registerDao(Record.class, recordDao);
    }
    
    public void clear() {
        userDaoConfig.clearIdentityScope();
        userMusicDaoConfig.clearIdentityScope();
        mediaDaoConfig.clearIdentityScope();
        musicDaoConfig.clearIdentityScope();
        poemDaoConfig.clearIdentityScope();
        recordDaoConfig.clearIdentityScope();
    }

    public UserDao getUserDao() {
        return userDao;
    }

    public UserMusicDao getUserMusicDao() {
        return userMusicDao;
    }

    public MediaDao getMediaDao() {
        return mediaDao;
    }

    public MusicDao getMusicDao() {
        return musicDao;
    }

    public PoemDao getPoemDao() {
        return poemDao;
    }

    public RecordDao getRecordDao() {
        return recordDao;
    }

}
